package util;

import java.util.Calendar;
import java.util.Date;

public class GetTimeTicks {
	
	 public static long getTicks(String epochStr)
	 {
	  //convert the target-epoch time to a well-format string
	   String date = new java.text.SimpleDateFormat("yyyy/MM/dd/HH/mm/ss").format(new Date (Long.parseLong(epochStr)));
	   String[] ds=date.split("/");
	     
	   //start of the ticks time
	  Calendar calStart=Calendar.getInstance();
	  calStart.set(1, 1, 3, 0, 0, 0);
	  
	  //the target time
	  Calendar calEnd=Calendar.getInstance();
	  calEnd.set(Integer.parseInt(ds[0]) ,Integer.parseInt(ds[1]),Integer.parseInt(ds[2]),Integer.parseInt(ds[3]),Integer.parseInt(ds[4]),Integer.parseInt(ds[5]) );
	  
	  //epoch time of the ticks-start time
	  long epochStart=calStart.getTime().getTime();
	  //epoch time of the target time
	  long epochEnd=calEnd.getTime().getTime();
	  
	  //get the sum of epoch time, from the target time to the ticks-start time
	   long all=epochEnd-epochStart;    
	   //convert epoch time to ticks time
	      long ticks=( (all/1000) * 1000000) * 10;
	     
	      return ticks;
	 }
}
